<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <c:set var="path" value="${pageContext.request.contextPath}"/> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${path}/page/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>任务</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../layui/layui/css/layui.css"  media="all">
</head>
<body>
        <ul class="layui-nav">
                <li class="layui-nav-item"><a href="../index.html">首页</a></li>
                <li class="layui-nav-item"><a href="../weixiu.html">专业维修</a></li>
                <li class="layui-nav-item"><a href="">服务</a></li>
                <li class="layui-nav-item layui-this">
                        <a href="javascript:;">个人中心</a>
                        <dl class="layui-nav-child">
                          <dd><a href="registe1.html">>登录</a></dd>
                          <dd><a href="">注册</a></dd>
                        </dl>
                      </li>
                <li class="layui-nav-item"><a href="">关于我们</a></li>
              </ul>
<center>          
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>任务发布</legend>
</fieldset>
</center> 
<form class="layui-form"  method="post" action="../action/mission/save" enctype="multipart/form-data">
<div style="width:24%">
  <div class="layui-form-item">
    <label class="layui-form-label">姓名</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入姓名" class="layui-input" value="${mission.name}">
    </div>
  </div>
</div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">手机</label>
      <div class="layui-input-inline">
        <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" placeholder="11位手机号" class="layui-input" value="${mission.phone}">
      </div>
    </div>
    <div class="layui-inline">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-inline">
        <input type="text" name="email" lay-verify="email" autocomplete="off" placeholder="格式为——@——" class="layui-input" value="${mission.mail}">
      </div>
    </div>
  </div>
  
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">验证日期</label>
      <div class="layui-input-inline">
        <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="${mission.date}">
      </div>
    </div>
  </div>
  <div style="width: 50%">
  <div class="layui-form-item">
    <label class="layui-form-label">任务类目</label>
    <div class="layui-input-block">
      <select name="style" id="quiz">
        <option value=""></option>
        <option value="家具">家具</option>
        <option value="灯具">灯具</option>
        <option value="卫浴">卫浴</option>
        <option value="家电">家电</option>
        <option value="墙纸">墙纸</option>
        <option value="地毯">地毯</option>
      </select>
    </div>
  </div>
</div>
<div class="layui-form-item">
        <label class="layui-form-label">任务类型</label>
        <div class="layui-input-block">
          <input type="checkbox" name="like[wx]" title="维修" value="${mission.kind}">
          <input type="checkbox" name="like[az]" title="安装" value="${mission.kind}">
          <input type="checkbox" name="like[zj]" title="质检" value="${mission.kind}">
        </div>
      </div>
  <div style="width: 50%">
        <div class="layui-form-item">
          <label class="layui-form-label">地址</label>
          <div class="layui-input-block">
            <input type="text" name="address" lay-verify="title" autocomplete="off" placeholder="请输入详细地址" class="layui-input" value="${mission.address}">
          </div>
        </div>
      </div>
  <div style="width:60%">
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">具体说明</label>
    <div class="layui-input-block">
      <textarea placeholder="维修说明" class="layui-textarea" name="showtxt" value="${mission.show}"></textarea>
    </div>
  </div>
</div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1" action ="">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
<script src="../layui/layui/layui.js" charset="utf-8"></script>
<script>
layui.use('element', function(){
  var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
  
  //监听导航点击
  element.on('nav(demo)', function(elem){
    //console.log(elem)
    layer.msg(elem.text());
  });
});
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  var $ = layui.$;
  
//  <c:if test="${!empty mission}">
//  $('#quiz').val(${mission.address});
 // </c:if>
  
  //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
  
  //创建一个编辑器
  var editIndex = layedit.build('LAY_demo_editor');
 
  //自定义验证规则
  form.verify({
    title: function(value){
      if(value.length < 3){
        return '标题至少得3个字符啊';
      }
    }
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  
  //监听指定开关
  form.on('switch(switchTest)', function(data){
    layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
      offset: '6px'
    });
    layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
  });
  
  //监听提交
  form.on('submit(demo1)', function(data){
    layer.alert(JSON.stringify(data.field), {
      title: '最终的提交信息'
    })
    return false;
  }); 
});
</script>
</body>
</html>